package com.sys.servlet.mgr.customer;

import com.sys.pojo.JsonResult;
import com.sys.service.CustomerService;
import com.sys.utils.WriteJson;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;
@WebServlet(urlPatterns = "/mgr/customer/showTrainer")
public class showTrainerListServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter writer = resp.getWriter();
        JsonResult jr = new JsonResult();
        CustomerService service = new CustomerService();
        try {
            List<Map<String, Object>> list = service.showTrainerList();
            jr.setCode(0);
            jr.setData(list);
        } catch (Exception e) {
            e.printStackTrace();
            jr.setCode(500);
            jr.setMsg("操作发生错误");
        }
        WriteJson.write(resp,jr);
    }
}
